/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Table;

import Boundary.TU;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Cross Over
 */
public class TUPresensiTabelModel extends AbstractTableModel{

    private List<TU> Tu = new ArrayList<TU>();

    public TUPresensiTabelModel(List<TU> tu) {
        this.Tu = tu;
    }

    public int getRowCount() {
        return this.Tu.size();
    }

    public int getColumnCount() {
        return 7;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        TU tu = Tu.get(rowIndex);
        switch (columnIndex)
        {
            case 0:return tu.getNis().getNIS();
            case 1:return tu.getNama().getNama();
            case 2:return tu.getKelas().getKelas();
            case 3:return tu.getMasuk().getMasuk();
            case 4:return tu.getIjin().getIjin();
            case 5:return tu.getSakit().getSakit();
            case 6:return tu.getTidakmasuk().getTidakmasuk();
            default:return "";
        }
    }
    
    @Override
    public String getColumnName(int columnIndex){
        switch (columnIndex){
            case 0: return "NIS";
            case 1: return "Nama";
            case 2: return "Kelas";
            case 3: return "Masuk";
            case 4: return "Ijin";
            case 5: return "Sakit";
            case 6: return "Tidak Hadir";
            default: return "";
        }
    }
}
